package com.ymatou.iapi.userregister.testcase;

import java.io.IOException;
import java.util.Date;
import java.util.List;

import org.apache.http.client.ClientProtocolException;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.ymatou.iapi.auth.parameter.SignAuthBean;
import com.ymatou.iapi.userregister.parameter.UserRegisterInfoRequestDtoBean;
import com.ymatou.iapi.userregister.parameter.UserRegisterVerifyCodeEnum;
import com.ymatou.iapi.userregister.service.UserRegisterInfoRequestDtoCall;
import com.ymatou.iapi.userservice.parameter.enums.ChannelSourceEnum;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P2;
import com.ymttest.business.service.JUserCallService;
import com.ymttest.common.enums.UserTerminalSourceEnum;
import com.ymttest.database.model.MailRecord;
import com.ymttest.database.model.Userinfo;
import com.ymttest.database.model.Userinfoex;
import com.ymttest.database.sqlwapper.EmailWapper;
import com.ymttest.database.sqlwapper.JUserWapper;
import com.ymttest.database.sqlwapper.UserSafeWapper;
import com.ymttest.utils.TestDataManager;

/**
 * 用户注册接口 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_UserRegisterInfoRequestDto {

	private static UserRegisterInfoRequestDtoBean userBean;
	private static UserRegisterInfoRequestDtoCall userCall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("用户注册接口");
	}

	@Before
	public void caseUp() throws InterruptedException {
		userBean = new UserRegisterInfoRequestDtoBean();
		userCall = new UserRegisterInfoRequestDtoCall();
		Logger.comment("更新注册风控");
		new UserSafeWapper().updateRiskStrategyStatus(1, "IP");
		new UserSafeWapper().updateRiskStrategyStatus(1, "device");
		new UserSafeWapper().updateRiskStrategyStatus(1, "IP_device");
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(userCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_001() {
		Logger.start(true,"用户注册成功");
		try {
			String loginId = "autotest_" + TestDataManager.randomStr(6);
			String loginMail = loginId + "@ymatou.com";
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userBean.setDeviceId((TestDataManager.getRandomUUID().toString()));
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(200, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("true", userCall.getString("Success"), "验证Success");
			
			verifyToken(userCall);
			verifyDB(userCall.getUserid(),userBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	



	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_002() {
		Logger.start(true,"app注册带deviceid用户注册成功");
		try {
			String loginId = "autotest_" + TestDataManager.randomStr(4);
			String loginMail = loginId + "@ymatou.com";
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 1;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;
			String deviceId=TestDataManager.getRandomUUID().toString();
			userBean.setDeviceId(deviceId);
			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);

			userCall.setData(userBean);
			userCall.callService();
			Logger.comment("result:" + userCall.getResult());
			Logger.comment("userid:" + userCall.getUserid());
			Logger.verifyEquals(200, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("true", userCall.getString("Success"), "验证Success");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_003() {
		Logger.start(true,"logindid20位以上,用户注册成功");
		try {
			String loginId = "autotest_" + TestDataManager.randomStr(20);
//			String loginMail = loginId + "@ymatou.com";
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
//			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);

			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(200, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("true", userCall.getString("Success"), "验证Success");
			verifyDB(userCall.getUserid(),userBean);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_004() {
		Logger.start(false,"logindid100位以上,用户注册失败");
		try {
			String loginId = "autotest_" + TestDataManager.randomStr(100);
			String loginMail = loginId + "@ymatou.com";
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);

			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(400, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("false", userCall.getString("Success"), "验证Success");
			String VerifyCode=userCall.getJsonObject().get("Result").getAsJsonObject().get("VerifyCode").getAsString();
			Logger.verifyEquals("LoginNameLengthError", VerifyCode, "验证返回的LoginNameLengthError信息");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	//邮箱注册现在取消了
	public void Tc_UserRegisterInfoRequestDto_005() {
		Logger.start(true,"商家用邮箱用户注册成功");
		try {
			String loginId = "autotest_" + TestDataManager.randomStr(4);
			String loginMail = loginId + "@ymatou.com";
//			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 1;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Other;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Pc;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
//			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);

			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(200, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("true", userCall.getString("Success"), "验证Success");
			verifyDB(userCall.getUserid(),userBean);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_006() {
		Logger.start(true,"传入TokenSource为sellerapp用户注册成功JIRACONN-2123");
		try {
			String loginId = "autotest_" + TestDataManager.randomStr(6);
//			String loginMail = loginId + "@ymatou.com";
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
//			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userBean.setTokenSource("sellerapp");
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(200, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("true", userCall.getString("Success"), "验证Success");
			verifyDB(userCall.getUserid(),userBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_007() {
		Logger.start(true,"传入TokenSource为app用户注册成功JIRACONN-2123");
		try {
			String loginId = "autotest_" + TestDataManager.randomStr(6);
//			String loginMail = loginId + "@ymatou.com";
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Other;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Ios;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
//			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userBean.setTokenSource("app");
			userBean.setDeviceId(TestDataManager.getRandomUUID().toString());
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(200, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("true", userCall.getString("Success"), "验证Success");
			verifyDB(userCall.getUserid(),userBean);
//			Map m=new HashMap<>();
//			m.put("Uid", userCall.getUserid());
//			Map history=new LoginHistoryWapper().selectUserRegHistoryByUid(m).get(0);
//			Logger.debug(history);
//			Logger.verifyEquals(userBean.getDeviceId(), history.get("DeviceId"), "验证凭据DeviceId");
//			Logger.verifyEquals(userBean.getClientIp(), history.get("ClientIp"), "验证凭据ClientIp");
//			Logger.verifyEquals("Other", history.get("ChannelSource"), "验证凭据ChannelSource");
//			//1 App
//			Logger.verifyEquals("MainSite", history.get("RegSource"), "验证凭据RegSource");
//			Logger.verifyEquals(userBean.getEquimentid(), history.get("Equimentid"), "验证凭据CookieId");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_008() {
		Logger.start(false,"EmailFormartError邮箱格式错误,失败");
		try {
			String loginId = "autotest_" + TestDataManager.randomStr(6);
			//String loginMail = TestDataManager.randomStr(6)+"@ymatou.com";
			String loginMail = "errormail"+ TestDataManager.randomStr(6);
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(400, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("false", userCall.getString("Success"), "验证Success");
			String VerifyCode=userCall.getJsonObject().get("Result").getAsJsonObject().get("VerifyCode").getAsString();
			Logger.verifyEquals("EmailFormartError", VerifyCode, "验证返回的EmailFormartError信息");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_009() {
		Logger.start(false,"邮箱重复EmailAlreadyExists,失败");
		try {
			String loginId = "autotest_" + TestDataManager.randomStr(6);
			String loginMail ="test@ymatou.com";
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(400, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("false", userCall.getString("Success"), "验证Success");
			String VerifyCode=userCall.getJsonObject().get("Result").getAsJsonObject().get("VerifyCode").getAsString();
			Logger.verifyEquals("EmailAlreadyExists", VerifyCode, "验证返回的EmailAlreadyExists信息");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_010() {
		Logger.start(false,"MobileFormartError,失败");
		try {
			String loginId = "autotest_" + TestDataManager.randomStr(6);
			String loginMail = TestDataManager.randomStr(6)+"@ymatou.com";
//			String loginMail = "errormail"+ TestDataManager.randomStr(6);
			String loginMobile = TestDataManager.randomStr(6)+"@ymatou.com";
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(400, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("false", userCall.getString("Success"), "验证Success");
			String VerifyCode=userCall.getJsonObject().get("Result").getAsJsonObject().get("VerifyCode").getAsString();
			Logger.verifyEquals("MobileFormartError", VerifyCode, "验证返回的MobileFormartError信息");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_011() {
		Logger.start(false,"MobileAlreadyExists,失败");
		try {
			String loginId = "autotest_" + TestDataManager.randomStr(6);
			String loginMail = TestDataManager.randomStr(6)+"@ymatou.com";
//			String loginMail = "errormail"+ TestDataManager.randomStr(6);
			String loginMobile = "13000000000";
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(400, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("false", userCall.getString("Success"), "验证Success");
			String VerifyCode=userCall.getJsonObject().get("Result").getAsJsonObject().get("VerifyCode").getAsString();
			Logger.verifyEquals("MobileAlreadyExists", VerifyCode, "验证返回的MobileAlreadyExists信息");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_012() {
		Logger.start(false,"LoginPasswordEmpty邮箱格式错误,失败");
		try {
			String loginId = "autotest_" + TestDataManager.randomStr(6);
			String loginMail = TestDataManager.randomStr(6)+"@ymatou.com";
//			String loginMail = "errormail"+ TestDataManager.randomStr(6);
			String loginMobile = TestDataManager.getPhoneNum();
//			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
//			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(400, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("false", userCall.getString("Success"), "验证Success");
			String VerifyCode=userCall.getJsonObject().get("Result").getAsJsonObject().get("VerifyCode").getAsString();
			Logger.verifyEquals("LoginPasswordEmpty", VerifyCode, "验证返回的LoginPasswordEmpty信息");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_013() {
		Logger.start(false,"LoginPasswordLenthLt6邮箱格式错误,失败");
		try {
			String loginId = "autotest_" + TestDataManager.randomStr(6);
			String loginMail = TestDataManager.randomStr(6)+"@ymatou.com";
//			String loginMail = "errormail"+ TestDataManager.randomStr(6);
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "1";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(400, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("false", userCall.getString("Success"), "验证Success");
			String VerifyCode=userCall.getJsonObject().get("Result").getAsJsonObject().get("VerifyCode").getAsString();
			Logger.verifyEquals("LoginPasswordLenthLt6", VerifyCode, "验证返回的LoginPasswordLenthLt6信息");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_014() {
		Logger.start(false,"LoginNameEmpty,失败");
		try {
//			String loginId = "autotest_" + TestDataManager.randomStr(6);
			//String loginMail = TestDataManager.randomStr(6)+"@ymatou.com";
			String loginMail = "errormail"+ TestDataManager.randomStr(6);
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

//			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(400, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("false", userCall.getString("Success"), "验证Success");
			String VerifyCode=userCall.getJsonObject().get("Result").getAsJsonObject().get("VerifyCode").getAsString();
			Logger.verifyEquals("LoginNameEmpty", VerifyCode, "验证返回的LoginNameEmpty信息");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_015() {
		Logger.start(false,"LoginNameContextError错误,失败");
		try {
			String loginId = "autotest+" + TestDataManager.randomStr(6);
			//String loginMail = TestDataManager.randomStr(6)+"@ymatou.com";
			String loginMail = "errormail"+ TestDataManager.randomStr(6);
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(400, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("false", userCall.getString("Success"), "验证Success");
			String VerifyCode=userCall.getJsonObject().get("Result").getAsJsonObject().get("VerifyCode").getAsString();
			Logger.verifyEquals("LoginNameContainSQLSensitiveCode", VerifyCode, "验证返回的LoginNameContextError信息");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_016() {
		Logger.start(false,"LoginNameFistLastError错误,失败");
		try {
			String loginId = "_autotest_" + TestDataManager.randomStr(6);
			//String loginMail = TestDataManager.randomStr(6)+"@ymatou.com";
			String loginMail = "errormail"+ TestDataManager.randomStr(6);
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(400, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("false", userCall.getString("Success"), "验证Success");
			String VerifyCode=userCall.getJsonObject().get("Result").getAsJsonObject().get("VerifyCode").getAsString();
			Logger.verifyEquals("LoginNameFistLastError", VerifyCode, "验证返回的LoginNameFistLastError信息");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_017() {
		Logger.start(false,"LoginNameFullNumberError错误,失败");
		try {
			String loginId = TestDataManager.getPhoneNum();
			//String loginMail = TestDataManager.randomStr(6)+"@ymatou.com";
			String loginMail = "errormail"+ TestDataManager.randomStr(6);
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(400, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("false", userCall.getString("Success"), "验证Success");
			String VerifyCode=userCall.getJsonObject().get("Result").getAsJsonObject().get("VerifyCode").getAsString();
			Logger.verifyEquals("LoginNameFullNumberError", VerifyCode, "验证返回的LoginNameFullNumberError信息");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_018() {
		Logger.start(false,"LoginNameAleradExists错误,失败");
		try {
			String loginId = "autotest";
			String loginMail = TestDataManager.randomStr(6)+"@ymatou.com";
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(400, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("false", userCall.getString("Success"), "验证Success");
			String VerifyCode=userCall.getJsonObject().get("Result").getAsJsonObject().get("VerifyCode").getAsString();
			Logger.verifyEquals("LoginNameAleradExists", VerifyCode, "验证返回的LoginNameAleradExists信息");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_019() {
		Logger.start(false,"LoginNameContainErrorCode错误,失败");
		try {
			String loginId = "洋码头客服" + TestDataManager.randomStr(6);
			//String loginMail = TestDataManager.randomStr(6)+"@ymatou.com";
			String loginMail = "errormail"+ TestDataManager.randomStr(6);
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(400, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("false", userCall.getString("Success"), "验证Success");
			String VerifyCode=userCall.getJsonObject().get("Result").getAsJsonObject().get("VerifyCode").getAsString();
			Logger.verifyEquals("LoginNameContainErrorCode", VerifyCode, "验证返回的LoginNameContainErrorCode信息");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_020() {
		Logger.start(false,"DisagreeContract错误,失败");
		try {
			String loginId = "autotest_" + TestDataManager.randomStr(6);
			//String loginMail = TestDataManager.randomStr(6)+"@ymatou.com";
			String loginMail = "errormail"+ TestDataManager.randomStr(6);
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = false;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(400, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("false", userCall.getString("Success"), "验证Success");
			String VerifyCode=userCall.getJsonObject().get("Result").getAsJsonObject().get("VerifyCode").getAsString();
			Logger.verifyEquals("DisagreeContract", VerifyCode, "验证返回的DisagreeContract信息");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_021() {
		Logger.start(false,"MailAndMobileIsNull错误,失败");
		try {
			String loginId = "autotest_" + TestDataManager.randomStr(6);
			//String loginMail = TestDataManager.randomStr(6)+"@ymatou.com";
//			String loginMail = "errormail"+ TestDataManager.randomStr(6);
//			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
//			userBean.setLoginMail(loginMail);
//			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(400, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("false", userCall.getString("Success"), "验证Success");
			String VerifyCode=userCall.getJsonObject().get("Result").getAsJsonObject().get("VerifyCode").getAsString();
			Logger.verifyEquals("MailAndMobileIsNull", VerifyCode, "验证返回的MailAndMobileIsNull信息");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
//	{
//		"LoginId": "爱到何时して",
//		"LoginMobile": "15262054366",
//		"Pas": "123456789ys",
//		"IsAgreeContract": true,
//		"RegSource": 1,
//		"ChannelSource": 0,
//		"TerminalSource": 3,
//		"ClientIp": "36.149.154.173",
//		"TokenTimeOut": 604800,
//		"DeviceId": "ffffffff-c748-0c1b-7ee3-a95b752d839c",
//		"Equimentid": "861297038148789",
//		"UserId": 18382331,
//		"RequestId": "147abaf4e4584055894ef187eed09345"
//	}{
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_022() {
		Logger.start(true,"日文商家用户注册成功");
		try {
			String loginId = "爱到何时して_" + TestDataManager.randomStr(6);
			String loginMail = TestDataManager.randomStr(10) + "@ymatou.com";
			String loginMobile = 4+TestDataManager.getRandomNum(10);
			String pas = "123456a";
			int registerType = 1;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(200, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("true", userCall.getString("Success"), "验证Success");
			
			verifyToken(userCall);
			verifyDB(userCall.getUserid(),userBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_023() {
		Logger.start(true,"邮件用户注册成功");
		try {
			String loginId = "autotest_" + TestDataManager.randomStr(6);
			String loginMail = loginId + "@ymatou.com";
//			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
//			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userBean.setEmailRegister(true);
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(200, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("true", userCall.getString("Success"), "验证Success");
			
			verifyToken(userCall);
			verifyDB(userCall.getUserid(),userBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_024() {
		Logger.start(false,"flag非邮件注册,邮件用户注册失败");
		try {
			String loginId = "autotest_" + TestDataManager.randomStr(6);
			String loginMail = loginId + "@ymatou.com";
//			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
//			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userBean.setEmailRegister(false);
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(400, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("false", userCall.getString("Success"), "验证Success");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_025() {
		Logger.start(true,"不输入RegisterType用户注册成功,默认买家");
		try {
			String loginId = "autotest_" + TestDataManager.randomStr(6);
			String loginMail = loginId + "@ymatou.com";
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
//			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(200, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("true", userCall.getString("Success"), "验证Success");
			
			verifyToken(userCall);
			verifyDB(userCall.getUserid(),userBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_026() {
		Logger.start(false,"用户注册不能使用其他用户的曾用名");
		try {
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			regbean.setLoginId("oldname_" + TestDataManager.randomStr(6));
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token = registerResult.get("Token").getAsString();
			Integer userId = urrc.getUserid();
			JUserCallService.SetNickName(userId, "newname_" + TestDataManager.randomStr(6));
			String loginId =regbean.getLoginId();
			String loginMail = loginId + "@ymatou.com";
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(400, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("false", userCall.getString("Success"), "验证Success");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_027() {
		Logger.start(true,"同环境用户反复注册,风控");
		try {
			new UserSafeWapper().updateRiskStrategyStatus(2, "IP");
			new UserSafeWapper().updateRiskStrategyStatus(1, "device");
			new UserSafeWapper().updateRiskStrategyStatus(1, "IP_device");
			String loginId = "autotest_" + TestDataManager.randomStr(6);
			String loginMail = loginId + "@ymatou.com";
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = TestDataManager.getRandomIp();
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userBean.setDeviceId((TestDataManager.getRandomUUID().toString()));
			userCall.setData(userBean);
			for(int i=0;i<7;i++){
				 loginId = "autotest_" + TestDataManager.randomStr(6);
				 loginMail = loginId + "@ymatou.com";
				 loginMobile = TestDataManager.getPhoneNum();
				userBean.setLoginId(loginId);
				userBean.setLoginMail(loginMail);
				userBean.setLoginMobile(loginMobile);
				userCall.callService();
			}
			Logger.verifyEquals(500, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("false", userCall.getString("Success"), "验证Success");
			Logger.verifyIsContains("风控", userCall.getString("LastErrorMessage"), "验证LastErrorMessage");
			new UserSafeWapper().updateRiskStrategyStatus(1, "IP");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_028() {
		Logger.start(true,"用户快速注册成功");
		try {
			String loginId = "autotest_" + TestDataManager.randomStr(6);
			String loginMail = loginId + "@ymatou.com";
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = TestDataManager.getRandomIp();
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userBean.setDeviceId((TestDataManager.getRandomUUID().toString()));
			userBean.setRegMethod(1);
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(200, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("true", userCall.getString("Success"), "验证Success");
			
			verifyToken(userCall);
			verifyDB(userCall.getUserid(),userBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_029() {
		Logger.start(true,"不传用户名密码用户快速注册成功");
		try {
//			String loginId = "autotest_" + TestDataManager.randomStr(6);
//			String loginMail = loginId + "@ymatou.com";
			String loginMobile = TestDataManager.getPhoneNum();
//			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = TestDataManager.getRandomIp();
			Long tokenTimeOut = (long) 1;

//			userBean.setLoginId(loginId);
//			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
//			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userBean.setDeviceId((TestDataManager.getRandomUUID().toString()));
			userBean.setRegMethod(1);
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(200, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("true", userCall.getString("Success"), "验证Success");
			
			verifyToken(userCall);
			verifyDB(userCall.getUserid(),userBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	//JIRACONN-11741 用户服务--注册去掉后增加的密码验证逻辑
	public void Tc_UserRegisterInfoRequestDto_030() {
		Logger.start(true,"密码过于简单失败");
		try {
			String loginId = "autotest_" + TestDataManager.randomStr(6);
			String loginMail = loginId + "@ymatou.com";
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userBean.setDeviceId((TestDataManager.getRandomUUID().toString()));
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(400, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("false", userCall.getString("Success"), "验证Success");
			Logger.verifyEquals("6~16位数字+字母组合的方式", userCall.getString("LastErrorMessage"), "验证LastErrorMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_031() {
		Logger.start(true,"用户名过短失败");
		try {
			String loginId =  TestDataManager.randomStr(3);
			String loginMail = loginId + "@ymatou.com";
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userBean.setDeviceId((TestDataManager.getRandomUUID().toString()));
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(400, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("false", userCall.getString("Success"), "验证Success");
			Logger.verifyEquals("昵称长度4~20位", userCall.getString("LastErrorMessage"), "验证LastErrorMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_032() {
		Logger.start(true,"用户邮件注册成功,验证邮箱");
		try {
			//需要条件 setEmailRegister=true
			long now=new Date().getTime();
			Thread.sleep(5000);
			String loginId = "autotest_" + TestDataManager.randomStr(6);
			String loginMail = "zhouyi@ymatou.com";
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 1;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Pc;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			new JUserWapper().deleteUserinfoByEmail(loginMail);
			userBean.setEmailRegister(true);
			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
//			userBean.setLoginMobile(loginMobile);
//			userBean.setActiveEmail(loginMail);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setRegMethod(0);
//			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
//			userBean.setDeviceId((TestDataManager.getRandomUUID().toString()));
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(200, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("true", userCall.getString("Success"), "验证Success");
			
			verifyToken(userCall);
			verifyDB(userCall.getUserid(),userBean);
			//异步调用api/user/register/event 等等
			Thread.sleep(5000);
			MailRecord mailinfo = new EmailWapper().selectMailRecordByToMail(loginMail).get(0);
			Logger.debug(FormatUtil.beanToGSONString(mailinfo));
			Logger.verifyEquals(userBean.getLoginMail(), mailinfo.getToMail(), "验证数据库表Mail_Record字段toMail");
			Logger.verifyEquals("BuyerRegistSuccess", mailinfo.getMailTemplateId(), "验证数据库表Mail_Record字段mailTemplateId");
			Logger.verifyIsContains(userBean.getLoginId(), mailinfo.getParameters(), "验证数据库表Mail_Record字段parameters包含loginid(是这个用户)");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_UserRegisterInfoRequestDto_033() {
		Logger.start(true,"特殊字符识别");
		try {
			String loginId = "autotest\r";
			String loginMail = loginId + "@ymatou.com";
			String loginMobile = TestDataManager.getPhoneNum();
			String pas = "123456a";
			int registerType = 0;
			Boolean isAgreeContract = true;
			int regSource = 0;
			int visitLan = 0;
			ChannelSourceEnum channelSource = ChannelSourceEnum.Alipay;
			UserTerminalSourceEnum terminalSource = UserTerminalSourceEnum.Android;
			String clientIp = "127.0.0.1";
			Long tokenTimeOut = (long) 1;

			userBean.setLoginId(loginId);
			userBean.setLoginMail(loginMail);
			userBean.setLoginMobile(loginMobile);
			userBean.setPas(pas);
			userBean.setRegisterType(registerType);
			userBean.setIsAgreeContract(isAgreeContract);
			userBean.setRegSource(regSource);
			userBean.setVisitLan(visitLan);
			userBean.setChannelSource(channelSource);
			userBean.setTerminalSource(terminalSource);
			userBean.setClientIp(clientIp);
			userBean.setTokenTimeOut(tokenTimeOut);
			userBean.setEquimentid(TestDataManager.getRandomUUID().toString());
			userBean.setDeviceId((TestDataManager.getRandomUUID().toString()));
			userCall.setData(userBean);
			userCall.callService();
			Logger.verifyEquals(400, userCall.getResponseCode(), "验证code");
			Logger.verifyEquals("false", userCall.getString("Success"), "验证Success");
			Logger.verifyEquals("LoginNameContainErrorCode", userCall.getResult().get("VerifyCode"), "验证VerifyCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
//		"LoginId": "MD萌＿66",
//		"LoginMobile": "13720199628",
//		"Pas": "syp52010",
//		"IsAgreeContract": true,
//		"RegSource": 1,
//		"ChannelSource": 0,
//		"TerminalSource": 3,
//		"ClientIp": "171.83.43.4",
//		"TokenTimeOut": 604800,
//		"DeviceId": "ffffffff-d766-e8e8-6ac3-bfbb70678613",
//		"Equimentid": "862379039299305",
//		"UserId": 18378395,
//		"RequestId": "5af9318c2d114cf098c779c4af17797e"
//	}{
//		"LoginId": "ｄｏｕ妈妈",
//		"LoginMobile": "15901006409",
//		"Pas": "MAying-0911",
//		"IsAgreeContract": true,
//		"RegSource": 1,
//		"ChannelSource": 0,
//		"TerminalSource": 2,
//		"ClientIp": "1.180.206.192",
//		"TokenTimeOut": 604800,
//		"DeviceId": "A12E7F97-D5B0-4AA1-9F54-BF75CA7D09C8",
//		"Equimentid": "f27614f7-d70c-4e0e-bf2c-2188d0b68085",
//		"UserId": 18382312,
//		"RequestId": "2e259461c32c414bac099829a06431e0"
//	}
//	{
//		"LoginId": "孙长长",
//		"LoginMobile": "14704128135",
//		"Pas": "sunchangmei8",
//		"IsAgreeContract": true,
//		"RegSource": 1,
//		"ChannelSource": 0,
//		"TerminalSource": 2,
//		"ClientIp": "119.114.112.48",
//		"TokenTimeOut": 604800,
//		"DeviceId": "3AD3396A-8400-4343-9DE3-B4097CF8D008",
//		"Equimentid": "a44738fb-c71c-432f-a85d-16c5c2c03aa9",
//		"UserId": 18378955,
//		"RequestId": "242eb1f7dd134e8cadccae122c2d0504"
//	}

	private void verifyDB(Integer uid, UserRegisterInfoRequestDtoBean createUserBean2) {
		JUserWapper ju=new JUserWapper();
		Logger.comment("验证Userinfo");
		List<Userinfo> lui = ju.selectUserinfoByUid(uid);
		Logger.verifyEquals(1, lui.size(), "验证记录条数");
		Userinfo ui = lui.get(0);
		if(createUserBean2.getRegMethod()==null||createUserBean2.getRegMethod()==0){
			Logger.verifyEquals(createUserBean2.getLoginId(), ui.getLoginId(), "验证LoginId");
		}else{
			Logger.verifyNotNull(ui.getLoginId(), "验证LoginId");
		}
		Logger.verifyEquals(createUserBean2.getLoginMobile(), ui.getLoginMobile(), "验证LoginMobile");
		Logger.verifyEquals(createUserBean2.getLoginMail(), ui.getLoginMail(), "验证LoginMail");
		if(createUserBean2.getRegisterType()!=null){
			Logger.verifyEquals(createUserBean2.getRegisterType(), ui.getUserType(), "验证UserType");
		}else{
			//默认0 买家
			Logger.verifyEquals(0, ui.getUserType(), "验证UserType");
		}
		Logger.verifyEquals(0, ui.getUserState(), "验证UserState");
		
		Logger.comment("验证Userinfoex");
		List<Userinfoex> luiex = ju.selectUserinfoexByUid(uid);
		Logger.verifyEquals(1, luiex.size(), "验证记录条数");
		Userinfoex uiex = luiex.get(0);
		//ChannelSource这里都是0表示从码头过来的注册，第三方走userservice
		Logger.verifyEquals(0, uiex.getChannelSource(), "验证ChannelSource");
		Logger.verifyEquals(createUserBean2.getRegSource(), uiex.getRegSource(), "验证RegSource");
		if(createUserBean2.getTerminalSource()!=null){
			Logger.verifyEquals(createUserBean2.getTerminalSource().getValue(), uiex.getTerminalSource(), "验证TerminalSource");
		}
		Logger.verifyEquals(createUserBean2.getVisitLan(), uiex.getVisitLanguage(), "验证getVisitLanguage");
		Logger.verifyEquals(createUserBean2.getEquimentid(), uiex.getEquimentid(), "验证Equimentid");
		Logger.verifyEquals(createUserBean2.getDeviceId(), uiex.getDeviceId(), "验证DeviceId");
		Logger.verifyEquals(createUserBean2.getClientIp(), uiex.getClientIp(), "验证ClientIp");
	}
	private void verifyToken(UserRegisterInfoRequestDtoCall userCall2) throws ClientProtocolException, IOException {
		JsonObject result = userCall.getJsonObject().get("Result").getAsJsonObject();
		String token=result.get("Token").getAsString();
		SignAuthBean sab=new SignAuthBean();
		sab.setToken(token);
		sab.setTokenSource(userBean.getTokenSource());
		Integer suid=JUserCallService.signAuth(sab).getUserId();
		Logger.verifyEquals(suid, userCall.getUserid(), "验证Token对应的uid");
	}
}